package org.example.basic.day04;

public class Demo内部类{
    public static void main(String[] args) {
        Outer outer=new Outer();
        outer.method();
    }
}

class Outer{
    public void method(){
        //加上final变为常量,延长生命周期以便该方法回收后还能使用num
          int num=20;
        class Inner{
            public void show(){
                System.out.println("num="+num);
            }
        }
        Inner inner=new Inner();
        inner.show();
    }
}